import {Injectable} from "@angular/core";

@Injectable()
export class UrlService {

  //环境：生产环境'prod', 测试环境'test', 默认生产
  public static env: string = 'prod';

  //接口前缀
  public static url_prefix = "http://outcall.cn/AppAPI2/";//正式环境
  public static url_prefix_test = "http://localhost:8080/AppAPI2/"; //测试环境

  //版本更新校验文件，注意不用前缀拼url字符串
  public static updateUrl(){return UrlService.getUrlPrefix() +"latestVersion/";}
  public static updateUrl2(){return 'http://res.woboss.gz186.com/update-yylm.xml';} //@ionic-native/app-update 用到



  //登陆
  public static url_login_submit_hb(){return UrlService.getUrlPrefix()  + 'login/';} //登录页-登陆按钮提交
  public static url_login_queryMemberTypes(){return UrlService.getUrlPrefix()  + 'twoLayerNavInfo/APP65837/';}//登陆页-获取成员类型
  public static url_login_generateSmsVerifyCode(){return UrlService.getUrlPrefix()  + 'generateSmsVerifyCode/';}//登陆页-获取短信验证码
  //主页
  public static url_mainContent_queryStaffFuncright(){return UrlService.getUrlPrefix()  + '/copserv/queryStaff/querystafffuncright';}//主页-获取菜单权限
  public static url_mainContent_qtySysAcct(){return UrlService.getUrlPrefix()  + '/copserv/qtySysAcct/qtySysAcct';}//主页-查询部门子账户
  public static url_mainContent_queryOrderSumInfo(){return UrlService.getUrlPrefix()  + '/copserv/order/getOrderSumInfo';}//主页-获取订单汇总信息
  public static url_mainContent_queryAPPStaffRights(){return UrlService.getUrlPrefix()  + '/copserv/rights/queryAPPStaffRights';}//主页-获取无纸化、电子发票功能权限
  public static url_mainContent_queryTags(){return UrlService.getUrlPrefix()  + '/copserv/rights/queryTags';}//主页-取活体检测开关

  //任务列表
  public static url_task(){return UrlService.getUrlPrefix()  + 'tasklist/';}
  public static url_taskcust(){return UrlService.getUrlPrefix()  + 'taskcustlist/';}
  public static url_uptaskcust(){return UrlService.getUrlPrefix()  + 'uptaskcust/';}
  public static url_custcustlist(){return UrlService.getUrlPrefix()  + 'custcustlist/';}

  /**
   * 获取接口地址前缀，主要用于切换生产和测试,先设置成测试地址，之后删掉
   * @returns {string}
   */
  public static getUrlPrefix(){
    console.log('getUrlPrefix env:' + this.env);

    if(UrlService.env == 'prod'){
      return UrlService.url_prefix_test;
    }
    else{
      return UrlService.url_prefix;
    }

  }


}
